# -*_ codeing=utf-8 -*-
# @Time: 2025/10/29 12:06
# @Author: foxhuty
# @File: many_to_many.py
# @Software: PyCharm
# @Based on python 3.10
from sqlalchemy.orm import sessionmaker
from sqlalchemy_notes.db_main import engine
from sqlalchemy_notes.student_manager.models import Users, RolePlayers

with sessionmaker(bind=engine).begin() as session:
    user1=Users(username='古力娜扎', password='123123')
    user2=Users(username='余佳恩', password='456456')
    user3=Users(username='Hina', password='789789')
    role1=RolePlayers(role_name='成都大区经理')
    role2=RolePlayers(role_name='生活秘书')
    role3=RolePlayers(role_name='会计出纳')
    # 娜扎有3个角色，余佳恩有一个角色，陈钰琪有2个角色
    user1.roles=[role1,role2]
    user2.roles=[role2]
    user3.roles=[role2,role3]

    session.add_all([user1,user2,user3])
